﻿@model IEnumerable<Isaac.Joy.Menu.Module.IMenu>
@{
    Layout = null;
}
<ul style="display: none;">
    @foreach (var menu in Model)
    {
        <li>
            @if (!menu.IsLeaf)
            {
                <a class="item">
                    <div class="arrow"></div>
                    @for (var i = 0; i < ViewBag.Level; i++)
                    {
                        <div class="expandable"></div>
                    }
                    <div class="folder close"></div>
                    <span>@menu.Name</span>
                </a>
                    Html.RenderAction("Tree", new { childrens = menu.Childrens, level = ViewBag.Level + 1 });
            }
            else
            {
                <a navid="@menu.Action.Id" href="@menu.Action.Url" target="@(string.IsNullOrEmpty(menu.Action.Target) ? "mainframe" : menu.Action.Target)" class="item">
                    <div class="arrow"></div>
                    @for (var i = 0; i < ViewBag.Level; i++)
                    {
                        <div class="expandable"></div>
                    }
                    <span>@menu.Name</span>
                </a>
            }
        </li>
    }
</ul>   
